package com.caregiver.watch.business.care.model.vo;

import com.caregiver.watch.business.data.enums.SportTypeEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @Description: 运动数据详情
 * @Author 疆戟
 * @Date 2025/10/20 20:57
 * @Version 1.0
 */
@Data
@Schema(description = "运动数据详情")
public class SportDataDetailVo {

    @Schema(description = "运动数据详情")
    private List<SportDataDetail> sportDataDetails;

    public static SportDataDetailVo build(List<SportDataDetail> sportDataDetails) {
        SportDataDetailVo sportDataDetailVo = new SportDataDetailVo();
        sportDataDetailVo.sportDataDetails = sportDataDetails;
        return sportDataDetailVo;
    }

    @Data
    @Schema(description = "运动数据详情")
    public static class SportDataDetail {

        @Schema(description = "运动类型")
        private SportTypeEnum sportType;

        @Schema(description = "运动距离")
        private BigDecimal distance;

        @Schema(description = "运动时长(分钟)")
        private Integer duration;

        @Schema(description = "卡路里")
        private BigDecimal calories;

        @Schema(description = "总次数")
        private Integer totalCount;

        @Schema(description = "运动数据记录")
        private List<SportDataRecord> sportDataRecords;

        public static SportDataDetail build(SportTypeEnum sportType, BigDecimal distance, Integer duration, BigDecimal calories, Integer totalCount, List<SportDataRecord> sportDataRecords) {
            SportDataDetail sportDataDetail = new SportDataDetail();
            sportDataDetail.sportType = sportType;
            sportDataDetail.distance = distance;
            sportDataDetail.duration = duration;
            sportDataDetail.calories = calories;
            sportDataDetail.totalCount = totalCount;
            sportDataDetail.sportDataRecords = sportDataRecords;
            return sportDataDetail;
        }
    }



    @Data
    @Schema(description = "运动数据记录")
    public static class SportDataRecord {

        // 运动距离
        @Schema(description = "运动距离")
        private BigDecimal distance;

        // 运动时长(分钟)
        @Schema(description = "运动时长(分钟)")
        private Integer duration;

        // 卡路里
        @Schema(description = "卡路里")
        private BigDecimal calories;

        // 运动开始时间
        @Schema(description = "运动开始时间")
        @JsonFormat(pattern = "yyyy/MM/dd HH:mm", timezone = "GMT+8")
        private LocalDateTime startTime;

        // 运动结束时间
        @Schema(description = "运动结束时间")
        @JsonFormat(pattern = "yyyy/MM/dd HH:mm", timezone = "GMT+8")
        private LocalDateTime endTime;

        public static SportDataRecord build(BigDecimal distance, Integer duration, BigDecimal calories, LocalDateTime startTime, LocalDateTime endTime) {
            SportDataRecord sportDataRecord = new SportDataRecord();
            sportDataRecord.distance = distance;
            sportDataRecord.duration = duration;
            sportDataRecord.calories = calories;
            sportDataRecord.startTime = startTime;
            sportDataRecord.endTime = endTime;
            return sportDataRecord;
        }
    }






}
